package com.example.meitao.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by 琚雷 on 2016-8-1.
 */
public class ShowPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> mFragments;
    private  List<String> mTitles;
    public ShowPagerAdapter(FragmentManager fm,List<Fragment> fragmentList,List<String> data) {
        super(fm);
        mFragments =fragmentList;
        mTitles=data;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments==null?0:mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position);
    }
}
